﻿using System;
using ActivateYourGlutes.Data;
using ActivateYourGlutes.Data.Model;

namespace ActivateYourGlutes.Model.Tests.Integration
{
    public class IntegrationTestEntityModelFactory : IEntityModelFactory
    {
        private const string ConnectionString =
            "metadata=res://ActivateYourGlutes.Model/Internal.Model.csdl|res://ActivateYourGlutes.Model/Internal.Model.ssdl|res://ActivateYourGlutes.Model/Internal.Model.msl;provider=System.Data.SqlClient;provider connection string=\"Data Source=(local);Initial Catalog=ActivateYourGlutes;Integrated Security=True;MultipleActiveResultSets=True\"";

        public IRepository<T> GetRepository<T>() where T : class
        {
            return new EntityFrameworkRepository<T>(ConnectionString);
        }

        public IRepository<T> GetRepository<T>(IRepositoryBase existingRepository) where T : class
        {
            return new EntityFrameworkRepository<T>((EntityFrameworkRepositoryBase)existingRepository);
        }
    }
}